package com.pdsu.alumni.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;
import com.pdsu.alumni.util.StringToJsonSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;

/**
 * <p>
 *
 * </p>
 *
 * @author Acerola
 * @since 2021-12-02
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_cover")
@ApiModel(value = "Cover对象", description = "")
public class Cover implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "cover_id", type = IdType.AUTO)
    private Integer coverId;

    private String coverUid;

    private String coverName;

    @ApiModelProperty(value = "封面文件类型")
    @TableField(value = "cover_type")
    private String coverType;

    private String coverStatus;

    @ApiModelProperty(value = "封面url")
    private String coverUrl;

    private Integer mid;

    @ApiModelProperty(value = "逻辑删除,1启用,0删除")
    @TableLogic
    private Integer deleted;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

//    @ApiModelProperty(value = "cover数据集")
//    @JSONField(serializeUsing = StringToJsonSerializer.class)
//    private String coverMap;

    public Cover(String name, String url, String type, Integer mid,String coverUid) {
        this.coverUid = coverUid;
        this.coverStatus = "done";
        this.coverName = name;
        this.coverUrl = url;
        this.coverType = type;
        this.mid = mid;
    }
}
